<?php
namespace API\Controller;
use Think\Controller;
class ManagetwosortController extends CommonController {
	//载入二级商品分类信息 
	// true表示载入成功 false失败
	//标识码 0表示失败 1表示成功
	public function loadtwosort(){
		$TwoSort = M('Twosort');
		$sort_id = I("post.sort_id");
		if (empty($sort_id)) {
			$TwoSortdata = $TwoSort->order("id ASC")->select();
		}else{
			$TwoSortdata = $TwoSort->order("id ASC")->where("sortid={$sort_id}")->select(); 
		}
		if (empty($TwoSortdata)) {
		             $this->response("载入二级商品分类信息",false,0,"二级商品分类信息为空");	
		}else{

			$TwoSortdatalist = array();
			$Sort = M("Sort");
			foreach ($TwoSortdata as $value) {
				$value['twosortimgurl'] = json_decode($value['twosortimgurl'],true);
				$value['twosortimgurl'] = $value['twosortimgurl'][0];
				$sortdata = $Sort->where("id ={$value['sortid']}")->find();
				$value['sortname'] = $sortdata['sortname'];
				$TwoSortdatalist[ ] = $value;
			}
			$this->response("载入二级商品分类信息",true,1,$TwoSortdatalist);
		}
	}
	
}